﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace VIFON.DAL
{
    public class DARegion
    {
        internal List<Region> GetRegions()
        {
            try
            {
                using (var db = new DBVIFONDataContext())
                {
                    var temp = db.Regions;
                    return temp.Count() > 0 ? temp.ToList() : null;
                }
            }
            catch
            {
                return null;
            }
        }
        internal Region GetRegionNameById(int id)
        {
            try
            {
                using (var db = new DBVIFONDataContext())
                {
                    Region temp = db.Regions.Where(p=>p.Id==id).First();
                    return temp;
                }
            }
            catch
            {
                return null;
            }
        }
    }
}
